# Maintainer:

pkgname=meson-python
pkgver=0.15.0
pkgrel=1
pkgdesc='Meson PEP 517 Python build backend'
arch=(any)
url='https://github.com/mesonbuild/meson-python'
license=(MIT)
depends=(meson
         patchelf
         python
         python-packaging
         python-pyproject-metadata
         python-typing_extensions)
makedepends=(ninja
             python-build
             python-installer)
optdepends=('python-colorama: colored output')
checkdepends=(cython
              python-gitpython
              python-pytest
              python-pytest-mock
              python-wheel)
source=(https://github.com/mesonbuild/meson-python/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('7c29eb0d17bb7813f5e5c89f5df5f56eda446e263b4d4a9f5f286548a0eb385f')

prepare() {
  cd $pkgname-$pkgver
  sed -e '/ninja/d' -i pyproject.toml
}

build() {
  cd $pkgname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $pkgname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
# https://github.com/mesonbuild/meson-python/issues/397
  test-env/bin/python -m pytest -k 'not test_user_args'
}

package() {
  cd $pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
